/*
testing allegro game library
*/

#include "myview.h"

// ----------------- constructors ---------------- //
MyView::MyView() {
    
}

// --------------- getters/setters --------------- //
MyController* MyView::getController() {
    return controller;
}
void MyView::setController(MyController* val) {
    controller = val;
}

MyView* MyView::getParent() {
    return parent;
}
void MyView::setParent(MyView* val) {
    parent = val;
}

// ------------------- other --------------------- //
void MyView::addChild(MyView* val) {
    val->setParent(this);
    children.push_back(val);
}
void MyView::removeChild(MyView* val) {
    for(int i = 0; i < children.size(); i++) {
        if(children[i] == val) {
            children.erase(children.begin() + i);
            break;
        }
    }
}

void MyView::draw() {
    drawme();

    for(int i = 0; i < children.size(); i++) {
        children[i]->draw();
    }
}

